﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SaveTheQueen.Scene;
using SaveTheQueen.Utils;
using SaveTheQueen.Component;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace DayAndKnight.Scenes
{
    public class TestScene : BaseScene
    {
        ImageSprite caster;
        ImageSprite shadow;

        public TestScene(GameCore core)
            : base(core)
        {
            ImageSprite background = new ImageSprite("Texturas/Platform", 0, 0, 800, 450, null, core);

            caster = new ImageSprite("Texturas/Game/ShipOne", 160, 160, 80, 80, background, core);
            shadow = new ImageSprite("Texturas/Game/ShipOne", 160, 160, 80, 80, background, core);

            shadow.Center = new Vector2(0.5f, 1f);
            shadow.Rotation = MathHelper.ToRadians(180f);
            //shadow.Effect = SpriteEffects.FlipVertically;

            this.Components.Add(background);
        }

        protected override void LoadContent()
        {
            base.LoadContent();
            shadow.Shader = Game.Content.Load<Effect>("Shaders/Shadow");
            shadow.Shader.Parameters["tangent"].SetValue((float)Math.Tan(MathHelper.ToRadians(30f)));
        }

        float angle = 30f;
        public override void Update(GameTime gameTime)
        {
            if (KeyboardInput.Debug == SaveTheQueen.Button.Down)
                throw new System.Exception("Debug key pressed! ( End )");

            angle += 0.5f;
            shadow.Shader.Parameters["tangent"].SetValue((float)Math.Tan(MathHelper.ToRadians(angle)));

            base.Update(gameTime);
        }
    }
}
